home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.19950929-19951130 / 000172_news@columbia.edu_Sat Oct 21 09:35:38 1995.msg < prev    next >
Internet Message Format  |  2020-01-01  |  4KB

  1. Received: from apakabar.cc.columbia.edu by watsun.cc.columbia.edu with SMTP id AA14288
  2.   (5.65c+CU/IDA-1.4.4/HLK for <kermit.misc@watsun.cc.columbia.edu>); Sun, 22 Oct 1995 11:07:17 -0400
  3. Received: by apakabar.cc.columbia.edu id AA27429
  4.   (5.65c+CU/IDA-1.4.4/HLK for kermit.misc@watsun); Sun, 22 Oct 1995 11:07:16 -0400
  5. Path: news.columbia.edu!spcuna!news.wctc.net!chi-news.cic.net!uwm.edu!cs.utexas.edu!news.cs.utah.edu!cc.usu.edu!jrd
  6. From: jrd@cc.usu.edu (Joe Doupnik)
  7. Newsgroups: comp.protocols.kermit.misc
  8. Subject: Re: Is there a bug in fonction \Fcode(Char)
  9. Message-Id: <1995Oct21.153538.64426@cc.usu.edu>
  10. Date: 21 Oct 95 15:35:38 MDT
  11. References: <468l5o$sai@midgard.calvacom.fr>
  12. Organization: Utah State University
  13. Lines: 92
  14. Apparently-To: kermit.misc@watsun.cc.columbia.edu
  15.  
  16. In article <468l5o$sai@midgard.calvacom.fr>, do11@calvacom.fr (Dominique Ottello) writes:
  17. > Hello from France.
  18. > I think there is a bug into Kermit MS-DOS Version 3.14
  19. > The fonction \Fcode(Char) return the value 150 for a space as for u-circomflex
  20. > I try this :
  21. > define line ==   SERIAL NUMBER : D00536      ==
  22. > ;
  23. > ; Search for position of (:) into Line
  24. > assign Begin \Findex(:,\m(Ligne),1)         <<< TYPO, \m(line)
  25. > increment Begin
  26. > ;
  27. > ; Extract substring beginning after (:) to the end of Line into SN2End
  28. > assign SN2End \Fsubstr(\m(Line),\m(Begin),)
  29. > ;
  30. > define \%n 1
  31. > :Bcl
  32. > assign Tmp \Fsubstr(\m(SN2End),\%n,1)
  33. > ;
  34. > assign Ascii \Fcode(\m(Tmp))
  35. > echo {Char=\m(Tmp) Code=\m(Ascii)}
  36. > ;
  37. > ; Test if the character is a Space
  38. > if = \m(Ascii) 32 goto LenOK
  39. > increment \%n
  40. > goto Bcl
  41. > ;
  42. > :LenOK
  43. > decrement \%n
  44. > assign SN \Fsubstr(\m(SN2End),1,\%n)
  45. > echo Line=\M(Line)
  46. > echo {SN extracted from Line=\m(SN)}
  47. > There are spaces after D00536 into variable Line,
  48. > but the fonction \Fcode(\m(Tmp)) always return 150 when Tmp is a space.
  49. > So, I am not able to test where ends the serial number.
  50. > Is there a patch to correct this problem ?
  51. > Or is there any possibility to do this test another way ?
  52. > Best Regards
  53. > Dominique Ottello
  54. > do11@calvacom.fr
  55. ---------
  56.     The problem is straight forward to discover and to solve. It is
  57. a \fsubstr() operation can result in a space, and if that is the only
  58. definition for an ASSIGN command then the definition appears to be empty
  59. and the variable is undefined/removed.
  60.     Aside from the typo noted above here is a version of your script
  61. which works. Note that you have a possible infinite loop, which should
  62. be avoided by   set count \flength(string), ... if count  to terminate
  63. after examining all string bytes. I removed some of your lines by ;;;
  64. comment indicators and slipped in the count saftey net.
  65.  
  66. define line ==   SERIAL NUMBER : D00536      ==
  67. ;
  68. ; Search for position of (:) into Line
  69. assign Begin \Findex(:,\m(Line),1)
  70. increment Begin
  71. ;
  72. ; Extract substring beginning after (:) to the end of Line into SN2End
  73. assign SN2End \Fsubstr(\m(Line),\m(Begin),)
  74. ;
  75. define \%n 1
  76. ;; optional safety net by jrd
  77. set count \flength(SN2End)
  78.  
  79. :Bcl
  80. ;;;assign Tmp \Fsubstr(\m(SN2End),\%n,1)
  81. ;
  82. ;;;assign Ascii \Fcode(\m(Tmp))
  83. assign Ascii \Fcode(\Fsubstr(\m(SN2End),\%n,1))
  84. ;;;echo Char=\m(Tmp) Code=\m(Ascii)
  85. echo Char=\Fsubstr(\m(SN2End),\%n,1) Code=\m(Ascii)
  86. ;
  87. ; Test if the character is a Space
  88. if = \m(Ascii) 32 goto LenOK
  89. increment \%n
  90. ;; optional safety net by jrd
  91. if count -
  92. goto Bcl
  93. ;
  94. :LenOK
  95. decrement \%n
  96. assign SN \Fsubstr(\m(SN2End),1,\%n)
  97. echo Line=\M(Line)
  98. echo {SN extracted from Line=\m(SN)}
  99.  
  100.     Joe D.